<!-- /*
 *  mini-SaaS
 *  Application for developing Software as a Service (SaaS) 
 *  Copyright (c) 2011 Anand Sudhakaran, Bryce Holton, Chao Zhang
 *  ASU
 *
 *  This file is part of mini-SaaS.
 *
 *  mini-SaaS is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  mini-SaaS is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.

 *  You should have received a copy of the GNU General Public License
 *  along with mini-SaaS; if not, see <http://www.gnu.org/licenses/>. 
 *
 */
  -->

<%@page contentType="text/html;charset=UTF-8"%>
<% request.setCharacterEncoding("UTF-8"); %>
<HTML>
<HEAD>
<TITLE>Result</TITLE>
<link href="twoColFixLtHdr.css" rel="stylesheet" type="text/css" /><!--[if IE 5]>
<style type="text/css"> 
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css"> 
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
</HEAD>
<BODY class="twoColFixLtHdr">
<jsp:useBean id="sampleServicesProxyid" scope="session" class="loginbean.ServicesProxy" />
<jsp:useBean id="sampleAddToCartServiceProxyid" scope="session" class="loginbean.AddToCartServiceProxy" />
<jsp:useBean id="sampleChooseShippingOptionServiceProxyid" scope="session" class="loginbean.ChooseShippingOptionServiceProxy" />
<jsp:useBean id="sampleCreateAccountServiceProxyid" scope="session" class="loginbean.CreateAccountServiceProxy" />
<jsp:useBean id="sampleDisplayProductsServiceProxyid" scope="session" class="loginbean.DisplayProductsServiceProxy" />
<jsp:useBean id="sampleLoginServiceProxyid" scope="session" class="loginbean.LoginServiceProxy" />
<jsp:useBean id="samplePrintShippingTimeEstimateServiceProxyid" scope="session" class="loginbean.PrintShippingTimeEstimateServiceProxy" />
<jsp:useBean id="sampleSendTrackingNumberToShipperServiceProxyid" scope="session" class="loginbean.SendTrackingNumberToShipperServiceProxy" />
<jsp:useBean id="sampleApplyCouponServiceProxyid" scope="session" class="loginbean.ApplyCouponServiceProxy" />
<jsp:useBean id="sampleCalculateTaxServiceProxyid" scope="session" class="loginbean.CalculateTaxServiceProxy" />
<jsp:useBean id="sampleCalculateTotalServiceProxyid" scope="session" class="loginbean.CalculateTotalServiceProxy" />
<jsp:useBean id="sampleVerifyCreditCardServiceProxyid" scope="session" class="loginbean.VerifyCreditCardServiceProxy" />
<jsp:useBean id="samplePrintConfirmationServiceProxyid" scope="session" class="loginbean.PrintConfirmationServiceProxy" />
<jsp:useBean id="sampleViewProductDetailsServiceProxyid" scope="session" class="loginbean.ViewProductDetailsServiceProxy" />

<% int tenantId = Integer.parseInt(session.getAttribute("tenantid").toString()); %>
<div id="container">
  <div id="header">
    <h1><% out.println(sampleServicesProxyid.getHeader(tenantId)); %></h1>
  <!-- end #header --></div>
  <div id="sidebar1">
    <h3>Sidebar</h3>
    <p><% out.println(sampleServicesProxyid.getSideBar(tenantId)); %></p>
  <!-- end #sidebar1 --></div>

<div id="mainContent">
<%
if (request.getParameter("endpoint") != null && request.getParameter("endpoint").length() > 0)
sampleServicesProxyid.setEndpoint(request.getParameter("endpoint"));
%>

<%
String method = request.getParameter("method");
int methodID = 0;
if (method == null) methodID = -1;

if(methodID != -1) methodID = Integer.parseInt(method);
boolean gotMethod = false;

try {
switch (methodID){ 
case 74:
	gotMethod = true;
	out.println(sampleDisplayProductsServiceProxyid.showAvailableProducts(tenantId));
break;
case 75:
	gotMethod = true;
	out.println(sampleLoginServiceProxyid.getLoginForm());
break;
case 76:
	gotMethod = true;
	//out.println(sampleAddToCartServiceProxyid.addProductToShoppingCart(tenantId, productName, custId));
break;
case 77:
	gotMethod = true;
	out.println(sampleChooseShippingOptionServiceProxyid.getChooseShippingOptionForm());
break;
case 78:
	gotMethod = true;
	out.println(sampleCreateAccountServiceProxyid.getCreateAccountForm());
break;
case 79:
	gotMethod = true;
	out.println(samplePrintShippingTimeEstimateServiceProxyid.printShippingTimeEstimate(0, "ups", tenantId));
break;
case 80:
	gotMethod = true;
	out.println(sampleSendTrackingNumberToShipperServiceProxyid.sendTrackingNumbertosShipper("http://ups.com"));
break;
case 81:
	gotMethod = true;
	out.println(sampleApplyCouponServiceProxyid.applyCoupon(tenantId, "10off"));
break;
case 82:
	gotMethod = true;
	out.println(sampleCalculateTaxServiceProxyid.calculateTax(tenantId));
break;
case 83:
	gotMethod = true;
	out.println(sampleCalculateTotalServiceProxyid.calculateTotal(tenantId));
break;
case 84:
	gotMethod = true;
	out.println(sampleVerifyCreditCardServiceProxyid.verifyCreditCard(tenantId,"1234 5678 1234 5678"));
break;
case 85:
	gotMethod = true;
	out.println(samplePrintConfirmationServiceProxyid.printConfirmation(tenantId));
break;
case 86:
	gotMethod = true;
	out.println(sampleViewProductDetailsServiceProxyid.viewDetails("test"));
break;
}
} catch (Exception e) { 
%>
exception: <%= e %>
<%
return;
}
if(!gotMethod){
%>
result: N/A
<%
}
%>
<!-- end #mainContent --></div>
  <div id="footer">
    <p><% out.println(sampleServicesProxyid.getFooter(tenantId)); %></p>
  <!-- end #footer --></div>
<!-- end #container --></div>
</BODY>
</HTML>
